package au.edu.unsw.editingtool.global;

import java.text.DateFormat;
import java.util.Date;

public class EditingToolException extends RuntimeException {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL);
	String messageTitle = "";
	String message = "";
	String error = "";
	
	public EditingToolException() {
		this.setMessageTitle();
	}
	
	public EditingToolException(String message, String error) {
		this.message = message;
		this.error = error;
	}
	
	public String sendError() {
		return this.message;
	}
	
	public void setMessage(String msg) {
		this.message = msg;
	}
	
	private void setMessageTitle() {
		this.messageTitle = "[" + this.df.format(new Date()) + "] Error found: ";		
	}
	
	public String sendMessage() {
		return this.messageTitle + this.message;
	}
	
	public String sendMessageHTML() {		
		String labelLeft = "<h3>";		
		String labelRight = "</h3>";
		return labelLeft + this.messageTitle + labelRight + this.message;		
	}
	
	public static void printStrings(String input[]) {
		System.out.println("Array {");
		for (int i = 0; i < input.length; i++) {
			System.out.println("index " +  i + " = " + input[i]);
		}
		System.out.println("}");
	}
	public void forwardError()
	{
		
	}
	
}
